<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="java.io.*, java.sql.*, java.util.*,LS.*, date.*, java.lang.String.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%request.setCharacterEncoding("utf-8"); %>

<!DOCTYPE html>
<html lang="UTF-8">
<style>
th,td {
	padding-bottom: 5px;
	padding-top: 5px;
}

#title{
	font: 17px; 
	font-weight:bold;
	text-align: right;
	width: 90px;
}

#result{
	text-align:left;
}

#content{
	text-align: left;
}
.txta{
	width:100%;
	height:100%;
}


b.text{
	font-size: 25px;
	margin-bottom: 10px;
}
h4,h1 {
	margin: 0px;
	padding: 0px;
}
th{
	height:30px;
	border-right: 1px solid #e5e5e5;
	border-bottom: 1px solid #e5e5e5;
}
tr{
	border-bottom: 1px solid #e5e5e5;
}
table {
	width: 100%;
}

.explain{
	color: red;
	font-size: 11px;
	border-bottom: 2px;
}
#outerview {
	padding-top: 10px;
	margin-left: 0px;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
#outerview {
	width: 93%;
	min-height: 600px;
	padding: 0px;
}
#middleview{
	width: 90%;
	height: 450px;
	margin: 20px auto 0px auto;
	left: 50%;
	
}
#innerview {
	width: 100%;
 	height: 100%;
 	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
} 

#innerviewleft,#innerviewright{
	margin-left:0px;
	padding-left:0px;
}

#plusview {
	margin:10px;
	margin-bottom:0px;
	text-align: left;
}
.tableview{
	width:100%;
	max-height:100%;
	left:50%;
}

.lendingdate{
	width:20%;
}
.notify{
	width:10%;
}
</style>
<head>
<script src="/LSsystem/assets/js/bootstrap.min.js"></script>

	
	<!-- styles시트 -->
	<link href="/LSsystem/assets/css/bootstrap.css" rel="stylesheet">
	<script type="text/javascript" src="<c:url value='/LSsystem/assets/js/jquery-1.9.1.js'/>" charset="utf-8"></script>

	<script type="text/javascript" src="/LSsystem/assets/smartPop/jquery.smartPop.js"></script>
	<link rel="stylesheet" href="/LSsystem/assets/smartPop/jquery.smartPop.css" />
	
	
	<script>
	$(document).ready(function() {
		$("#datepicker").datepicker();		 
	});

	</script>	

</head>
<body>
<c:if test=""></c:if>


<%if(request.getParameter("cnt")!=null) {
	int cnt = Integer.parseInt(request.getParameter("cnt"));
	if(cnt>0){
		if(request.getParameter("same")!=null){
			if(Integer.parseInt(request.getParameter("same"))==0){
		
%>
<div class="container">
	<%if(request.getParameter("a")!=null){
		Users user = (Users)session.getAttribute("user");
		String a = request.getParameter("a");
		if(a.equals("write")){
		%>
			<div id="outerview">
				<div id="middleview">
					<form method="post" action="addLendingLoading.do">
					<div id="plusview">
							<b class="text">대여 신청서</b>&nbsp;&nbsp;
					</div>
					<div id="innerview">
						<div id="innerviewleft" class="span10">
							<br>
							<br>
							<div id="title" class="span2">소속학과</div><div id="content" class="span2">
							<c:forEach var="d" items="${departments}">
								${d.departments_name }<br>
							</c:forEach>
							</div><br><br><br>
							
							<%-- 
							<%=request.getParameter("item_name") %>
							 --%>
							
							<%
								String item_name = request.getParameter("item_name");
								
								String b = request.getHeader("User-Agent");
								String browserInfo ="";
								String rightTableTDWidth ="";
								if(b.indexOf("MSIE 6.0") > 0 || b.indexOf("MSIE 7.0") > 0 || b.indexOf("MSIE 8.0") > 0||b.indexOf("MSIE 9.0") > 0||b.indexOf("MSIE 10.0") > 0) {
									item_name = new String(item_name.getBytes("8859_1"), "EUC-KR");
								}else{
									item_name = new String(request.getParameter("item_name").getBytes("iso-8859-1"), "utf-8");
								}
							%>
							
							<%-- 
							<script>
								alert(<%=item_name%>);
							</script>
							 --%>
							<div id="title" class="span2">학번</div><div id="content" class="span2"><%=user.getUser_id()%></div><br><br>
							<div id="title" class="span2">학년</div><div id="content" class="span2"><%=user.getGrade()%></div><br><br>
							<div id="title" class="span2">이름</div><div id="content" class="span2"><%=user.getName()%></div><br><br>
							<div id="title" class="span2">연락처</div><div id="content" class="span2"><%=user.getPhone()%></div><br><br>
							<div id="title" class="span2">품목명</div><div id="content" class="span2"><%=item_name%></div>&nbsp;&nbsp;&nbsp;
							<input type="hidden" name="item_id" value='${item.get(0).getItem_id() }'>
							<input type="hidden" name="did" value='${did.get(0).getDepartments_id() }'>
							<div id="title" class="span2">모델명</div><div id="content" class="span2"><%=request.getParameter("model_name") %></div><br><br>
							<input type="hidden" name="model_name" value='<%=request.getParameter("model_name") %>'>
							
<!-- 							<div id="title" class="span2" style="margin-top:5px;">대여일</div> -->
<!-- 							<div class="span2"> -->
<!-- 								<input type="text" id="datepicker"> -->
<!-- 							</div> -->
<!-- 							<div id="content" class="span1" style="width:70px;"> -->
<!-- 								<select name="y" style="width:70px"> -->
<%-- 									<option value="<%=getDate.getYear()%>"><%=getDate.getYear()%></option> --%>
<%-- 									<option value="<%=getDate.getYear()+1%>"><%=getDate.getYear()+1%></option> --%>
<!-- 								</select> -->
<!-- 							</div> -->
<!-- 							<div class="span1" style="width:15px; margin:5px; padding:0px;"> -->
<!-- 								<b>년</b> -->
<!-- 							</div> -->
<!-- 							<div class="span1" style="width:60px;margin-left:5px;"> -->
<!-- 								<select name="m" style="width:60px"> -->
<!-- 									<option>01</option> -->
<!-- 									<option>02</option> -->
<!-- 									<option>03</option> -->
<!-- 									<option>04</option> -->
<!-- 									<option>05</option> -->
<!-- 									<option>06</option> -->
<!-- 									<option>07</option> -->
<!-- 									<option>08</option> -->
<!-- 									<option>09</option> -->
<!-- 									<option>10</option> -->
<!-- 									<option>11</option> -->
<!-- 									<option>12</option> -->
<!-- 								</select> -->
<!-- 							</div> -->
<!-- 							<div class="span1" style="width:15px; margin:5px; padding:0px;"> -->
<!-- 								<b>월</b> -->
<!-- 							</div> -->
<!-- 							<div class="span1" style="width:60px;margin-left:5px;"> -->
<!-- 								<select name="d" style="width:60px"> -->
<!-- 									<option>01</option> -->
<!-- 									<option>02</option> -->
<!-- 									<option>03</option> -->
<!-- 									<option>04</option> -->
<!-- 									<option>05</option> -->
<!-- 									<option>06</option> -->
<!-- 									<option>07</option> -->
<!-- 									<option>08</option> -->
<!-- 									<option>09</option> -->
<%-- 									<c:forEach var="i" begin="10" end="31"> --%>
<%-- 										<option>${i }</option> --%>
<%-- 									</c:forEach> --%>
<!-- 								</select> -->
<!-- 							</div> -->
<!-- 							<div class="span1" style="width:15px; margin:5px; padding:0px;"> -->
<!-- 								<b>일</b> -->
<!-- 							</div> -->
							<input type="hidden" name="userid" value='<%=user.getUser_id()%>'>
							<br><br>
							<div id="title" class="span2">신청일자</div><div id="content" class="span2"><%=getDate.getdate(0)%></div><br><br>
							<div id="title" class="span2">기간</div>
							<div id="content" class="span6">
								<input type="radio" name="period" value="7" checked="checked">7일&nbsp;&nbsp;&nbsp;
								<input type="radio" name="period" value="14">14일&nbsp;&nbsp;&nbsp;
								<input type="radio" name="period" value="30">30일&nbsp;&nbsp;&nbsp;
								<input type="radio" name="period" value="365">365일
							</div><br><br>
							<div id="title" class="span8">비고</div><div id="content" class="span4"><textarea class="txta" name="reason"></textarea></div>
						</div>
					</div>
					<div  style="text-align: right;">
						<Button class="btn" type="submit">신청 완료</Button>
						<Button class="btn" onclick="parent.smartPopClose(); return false;" >취소</Button>
					</div>
					<input type="hidden" name="using" value="<%=request.getParameter("using") %>">
					</form>
				</div>
			</div>
		</div>
	<%}}}else{%>
	<center>
		<br><br><br><Br><Br>
		<b style="color:red">같은 물품은 1번밖에 대여 할 수 없습니다.</b>	
		<br><br><br>
		<Button class="btn" onclick="parent.smartPopClose(); return false;" >닫기</Button>
	</center>
	<% 
	}
	}%>
<%}else{ %>
<center>
	<br><br><br><Br><Br>
	<b style="color:red">해당 모델은 대여가능 갯수가 없기 때문에 대여 할 수 없습니다.</b>	
	<br><br><br>
	<Button class="btn" onclick="parent.smartPopClose(); return false;" >닫기</Button>
</center>
<%}} %>
</body>
</html>